<?php
	if($this->message)
		echo $this->message;
	else{?>
<table style="width:100%; text-align: center;">
	<tr>
		<th>
			Order Id
		</th>
		<th>
			User Id
		</th>
		<th>
			Total
		</th>
		<th>
			Adjusted Total
		</th>
		<th>
			Status
		</th>
		<th>
			Created On
		</th>
	</tr>
	<tr>
		<td>
			<?php echo $this->order['id']; ?>
		</td>
		<td>
			<?php echo $this->order['userId']; ?>
		</td>
		<td>
			<?php echo $this->order['total']; ?>
		</td>
		<td>
			<?php echo $this->order['adjustedTotal']; ?>
		</td>
		<td>
			<?php echo $this->order['status']; ?>
		</td>
		<td>
			<?php echo $this->order['createdOn']; ?>
		</td>
	</tr>
	<?php if($this->order['OrderAdjustments']):?>
	<tr>
		<th>Order Adjustments</th>
		<td colspan='3'>
			<?php var_dump($this->order['OrderAdjustments']);?>
		</td>
	</tr>
	<?php endif;?>
</table>
<table style="width:100%; text-align: center;">
	<tr>
		<th>
			Item Id
		</th>
		<th>
			Item Type
		</th>
		<th>
			Source
		</th>
		<th>
			Image
		</th>
		<th>
			Details
		</th>
		<th>
			Weight
		</th>
		<th>
			Price
		</th>		
		<th>
			MaxQnty
		</th>
	</tr>
	<?php foreach($this->orderItems as $items):?>
	<tr>
		<td>
			<?php echo $items['id']; ?>
		</td>
		<td>
			<?php $itemType = $items['itemType'];
					echo $itemType; ?>
		</td>
		<td>
			<?php echo $items['priceSource']; ?>
		</td>
		<td>
			<img src="<?php echo $items[$itemType . 's']['image']; ?>"></img>
		</td>
		<td>
			ISBN10 : <?php echo $items[$itemType . 's']['Isbn10']; ?><br/>
			ISBN13 : <?php echo $items[$itemType . 's']['Isbn13']; ?><br/>
			Title : <?php echo $items[$itemType . 's']['title']; ?><br/>
			Author : <?php echo $items[$itemType . 's']['author']; ?><br/>
		</td>
		<td>
			<?php echo $items['weight']; ?>
		</td>
		<td>
			<?php echo $items['price']; ?>
		</td>
		<td>
			<?php echo $items['maxQnty']; ?>
		</td>
	</tr>
	<?php if($items['ItemAdjustments']):?>
	<tr>
		<th>Items Adjustments</th>
		<td colspan='7'>
			<?php var_dump($items['ItemAdjustments']);?>
		</td>
	</tr>
	<?php endif;?>
	<?php endforeach;?>
</table>
<?php }?>
